package kz.alamty.dev.action;


import java.util.Collection;

import kz.alamty.dev.obj.Answer;
import kz.alamty.dev.service.TheService;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class AnswerAction extends ActionSupport implements ModelDriven<Object>  {

	private static final long serialVersionUID = -266669249104642869L;
	private TheService service = new TheService();
	private Answer model= new Answer();
	
	/**
	 * 
	 */
	private String message;

    private Long id;
	private Collection list;
	
	public String execute() {
		message = "Inside execute method";
		return SUCCESS;
	}

	public String vote()
	{
//		service.
		return SUCCESS;
	}
	
	public String add() {
		message = "Inside add method";
		return SUCCESS;
	}
	
    // GET /Question
    public String index() {
       // list = service.allQuestion();
//        return new DefaultHttpHeaders("index")
//            .disableCaching();
    	return SUCCESS;
    }

	public String update() {
		
		message = "Inside update method";
		return SUCCESS;
	}

	public String delete() {
		message = "Inside delete method";
		return SUCCESS;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	@Override
	public Object getModel() {
		return (list != null ? list : model);
	}

}
